package com.cs.study.homework._0206;

import java.util.Arrays;

public class Merge {
    public static void main(String[] args) {
        int[] arr1 = new int[]{1, 2, 3};
        int[] arr2 = new int[]{2, 2, 2};
        int[] merge = mergeArray(arr1, arr2);
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2));
        System.out.println(Arrays.toString(merge));
    }

    public  static int[] mergeArray(int[] arr1, int[] arr2) {
        int[] merge = new int[arr1.length + arr2.length];
        int count = 0;
        for (int i = 0; i < arr1.length; i++) {
            merge[i] = arr1[i];
            count++;
        }
        for (int j = 0; j <arr2.length; j++) {
            merge[count] = arr2[j];
            count++;
        }
        return merge;
    }
}
